<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix='sec' uri='http://www.springframework.org/security/tags'%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="scripts/boot.js"></script>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
	<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
	    <table style="width:100%;">
	        <tr>
	            <td style="width:100%;">
	            	<sec:authorize url='/remind_current_export.do'>
	                <a class="mini-button" iconCls="icon-download" onclick="exportCurrentData()">导出当前</a>
	                </sec:authorize>
	                <sec:authorize url='/remind_export.do'>
		            <a class="mini-button" iconCls="icon-download" onclick="exportData()">导出全部</a> 
		            </sec:authorize>
<%-- 		            <sec:authorize url='/reminder_edit.do'> --%>
<!-- 		            <a class="mini-button" iconCls="icon-edit" onclick="edit()">修改</a> -->
<%-- 		            </sec:authorize> --%>
		            <sec:authorize url='/remind_delete.do'>
		        	<a class="mini-button" iconCls="icon-remove" onclick="remove()">批量删除</a>    
		        	</sec:authorize>
	            </td>
	        </tr>
	    </table>           
	</div>
	<div class="mini-fit" >
	<div id="datagrid1" class="mini-datagrid " allowCellSelect="true" multiSelect="true" idField="id" pageSize="20" url="customer_remind_view.do" style="width:100%;height:100%;">
		<div property="columns">
			<div type="indexcolumn"></div>
			<div type="checkcolumn"></div>
			<div field="operatorUser" width="100" headerAlign="center" align="center">提醒客服</div>
			<div field="customerName" width="100" headerAlign="center" align="center">客户</div>
			<div field="content" width="200" headerAlign="center" align="center">提醒内容</div>
			<div field="reminderTime" width="100" headerAlign="center" allowSort="true" align="center">提醒时间</div>
			<div field="cycleVal" width="100" headerAlign="center" align="center">提醒周期</div>
		</div>
	</div>
	</div>
<script type="text/javascript">
mini.parse();
var grid = mini.get("datagrid1");
grid.load();

function search() {
    grid.load();
}

function onKeyEnter(e) {
    search();
}

//修改
// function edit() {
//     var row = grid.getSelecteds();
//     if (row.length == 1) {
//         mini.open({
//             url: "reminder_edit.do",
//             allowResize:false,
//             title: "修改", width: 560, height: 350,
//             onload: function () {
//                 var iframe = this.getIFrameEl();
//                 var data = { action: "reminder_save_edit.do", row: row[0] };
//                 iframe.contentWindow.SetData(data);
//             },
//             ondestroy: function (action) {
//             	if(action == 'succ'){
//             		mini.showMessageBox({
//                         title: "提示",
//                         showModal:false,
//                         iconCls: "mini-messagebox-info",
//                         message: "修改成功！",
//                         timeout: 3000,
//                         x: 'right',
//                         y: 'bottom'
//                     });
//                 	grid.reload();
//             	}
//             }
//         });
        
//     } else {
//     	mini.alert("请选中一条记录");
//     }
    
// }

//导出全部
function exportData() {
	location.href="remind_export.do";
}

//导出当前页数据
function exportCurrentData() {
	var data =grid.getData();
	var ids = [];
	$.each(data , function(){
        ids.push(this.id);
    });
	 var id = ids.join(',');
	 location.href="remind_current_export.do?ids=" +id;
}

//删除
function remove() {
	var ids = '';
    var rows = grid.getSelecteds();
    if (rows.length > 0) {
    	mini.confirm("确定删除选中记录？", "删除",
               function (action) {
                   if (action == "ok") {
                   	grid.loading("操作中，请稍后......");
                   	var rowIds = [];
                   	$.each(rows, function(i) {
                   		rowIds.push(rows[i].id);
                   	});
                   	ids = rowIds.join(',');
                       $.post(
                       	"remind_delete.do",
                       	{id:ids},
                       	function(data){
                       		mini.showMessageBox({
                                   title: "提示",
                                   showModal:false,
                                   iconCls: "mini-messagebox-info",
                                   message: "已删除！",
                                   timeout: 3000,
                                   x: 'right',
                                   y: 'bottom'
                               });
                       		grid.reload();
                       	},"json");
                   }
               });
        
    } else {
    	mini.alert("至少选中一条记录");
    }
}
</script>
</body>
</html>